﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title></title>
	 <style type = "text/css">
		  body{
			  font-family: Futura;
			  background-image: gray;
		  }
		  p{
			  color: maroon;
		  }
		  h1{
			  font-family: Zapfino;
			  color: gray;
			  font-size : 40;
			
		  }
	  </style>
    <script src="../googleAnalytics.js" type="text/javascript"></script>   
    <script src="http://maps.google.com/maps?file=api&amp;v=2&amp;key=ABQIAAAAHHQwI7Yl5wVURxsuvbc5jxSGEnaH5YVeejJ-C3XyzEKP1PH33BRW7_7WPjfpaLunAahTOD7Gd37cBw" type="text/javascript"></script>   
	<script type"text/javascript"> 
		window.onload=initialize;
		window.onunload=GUnload;
		
		
		
		var myLatlng = new google.maps.LatLng(-25.363882,131.044922);
  		var myOptions = {
    		zoom: 4,
    		center: myLatlng,
    		mapTypeId: google.maps.MapTypeId.ROADMAP
  		}
  		var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
    
  	
		var control;
		var geocoder = null;
		var bounds = new GLatLngBounds();
 
 
		// Very Basic Map setup on canvas
		function initialize() {      
			if (GBrowserIsCompatible()) {        
				map = new GMap2(document.getElementById("map_canvas"));        
				map.setCenter(new GLatLng(document.q.xpoint.value, document.q.ypoint.value), 13);    
				map.enableScrollWheelZoom();
 				var marker = new GMarker(map.getCenter()); 
				map.addOverlay(marker);
				document.q.address.value=response.Placemark[0].address; 
			}    
		}
 
	
 
	</script> 

</head>

</head>
<body>
	
	<?php

		$dbc = mysqli_connect( 'localhost' ,'root' , '', 'teresa' ) or die( 'Error connecting to MySQL server.');		
		$message_id = $_GET['message_id'];

		$query = "SELECT * FROM teresa_message WHERE message_id = '$message_id'";
		$data = mysqli_query( $dbc , $query) or die('ERROR queerying database.');

		$row = mysqli_fetch_array( $data );
		$subject = $row['subject'];
		$message = $row['message'];
		$response = $row['response'];
		$location_x = $row['location_x'];
		$location_y = $row['location_y'];
		echo $message_id;
		echo '<strong>Subject :'. $subject . '</strong></br>';
		echo 'message : ' . $message . '</br>';

		if( $response == 'none' ){
		
		?>
			<form action = "jump.php?response=yes&message_id=<?php echo $message_id; ?>" method="post" >
				<input type="submit" name="submit" value="Yes">
			</form>
			<form action = "jump.php?response=no&message_id=<?php echo $message_id; ?> " method="post" >
				<input type="submit" name="submit" value="No">
			</form>
			<p></br></p>
		<?php
		}else if( $response == 'yes' ){
			echo '<p>you select this message!</br></p>';
		}else if( $response == 'no' ){
			echo '<p>you passed this message!</br></p>';		
		}
		echo '<a href="inbox.php">Return to inbox</a>';

	?>
	<form name="q"> 
		<table>
			<tr>
				<td>
					<p>GLatlng :</p>
				</td>
				<td>
					<input type="text" id="xpoint" name="xpoint" value="<?php echo $location_x ?>">
					<input type="text" id="ypoint" name="ypoint" value="<?php echo $location_y ?>">
				</td>
				
			</tr>
			<tr>
				<td>
					<p>Address :</p>
				</td>
				<td>
					<textarea name="address" id="address" rows="2" cols="30"  ><?php echo $address ?></textarea>
				</td>
				
			</tr>
		</table>	
		<table>	
			<tr>		
				<td>
					<div id="map_canvas" style="margin: 1em 1em; width:400px; height: 300px; float:left"></div> 
					<div id="status"></div>		
				</td>
			</tr>
			<tr>
				
			</tr>
		</table>	
	</form> 	
	
</body>
</html>
